<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../5.25/vue.js"></script>
</head>
<body>
    <div id="app" v-my-directive>

    </div>
    <script>

        //自定义拆件对象
        let myPlugin = {}

        //向对象当中注入方法或函数
        myPlugin.install = function (Vue, options) {
            console.log('启动自定义插件的方法')
            console.log(options)

            Vue.directive("my-directive", {
                bind(el, binding) {
                    el.style = 'width:100px;height:100px;background-color:#ccc;'
                }
            })
        }
        //将自定义的插件注入到当中vue对象当中
        Vue.use(myPlugin, { someOption: true })
        var vm = new Vue ({
            el:"#app",

        })
    </script>
</body>
</html>